
import { makeAutoObservable, observable, action } from 'mobx';
import { ajax } from './../api/index';

export class Store {
    data: any = [];
    information: any = [];
    count:Number = 0
    constructor() {
        makeAutoObservable(this, {
            data: observable,
            count:observable,
            information:observable,
            changedata: action,
            changecount:action,

        })
       
    }

    changedata = () => {
        ajax.getHot().then((res) => {
            this.data = []
            this.data.push(res.result.filter((item: any) => { return item.sellCount > 100 }))
            console.log(this.data);
        })
    }
    changecount = (pyl:any)=>{
        this.count += pyl
        console.log(this.count);
        
    }
    changeInformation = (payload:any)=>{
        this.information = payload
    }
}